package com.stray.crawl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ResultContext {

	private long startTimestamp;
	private long finishTimestamp;
	private int connectElapsedTime;
	private int parseElapsedTime;
	private int processElapsedTime;

	private int statusCode;
	private String requestSummary;
	private String responseSummary;
	private Map<String, String> requestHeaders;
	private Map<String, String> responseHeaders;

	private Object content;
	private List<?> elements;
	private List<Object[]> results;

	private Map<String, Object> attributes = new HashMap<String, Object>();

	public void putAttribute(String key, Object obj) {
		attributes.put(key, obj);
	}

	public Object getAttribute(String key) {
		return attributes.get(key);
	}


	public long getElapsedTime() {
		return finishTimestamp - startTimestamp;
	}

	public long getStartTimestamp() {
		return startTimestamp;
	}

	public void setStartTimestamp(long startTimestamp) {
		this.startTimestamp = startTimestamp;
	}

	public long getFinishTimestamp() {
		return finishTimestamp;
	}

	public void setFinishTimestamp(long finishTimestamp) {
		this.finishTimestamp = finishTimestamp;
	}

	public int getConnectElapsedTime() {
		return connectElapsedTime;
	}

	public void setConnectElapsedTime(int connectElapsedTime) {
		this.connectElapsedTime = connectElapsedTime;
	}

	public int getParseElapsedTime() {
		return parseElapsedTime;
	}

	public void setParseElapsedTime(int parseElapsedTime) {
		this.parseElapsedTime = parseElapsedTime;
	}

	public int getProcessElapsedTime() {
		return processElapsedTime;
	}

	public void setProcessElapsedTime(int processElapsedTime) {
		this.processElapsedTime = processElapsedTime;
	}

	public int getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(int statusCode) {
		this.statusCode = statusCode;
	}

	public String getRequestSummary() {
		return requestSummary;
	}

	public void setRequestSummary(String requestSummary) {
		this.requestSummary = requestSummary;
	}

	public String getResponseSummary() {
		return responseSummary;
	}

	public void setResponseSummary(String responseSummary) {
		this.responseSummary = responseSummary;
	}

	public Map<String, String> getRequestHeaders() {
		return requestHeaders;
	}

	public void setRequestHeaders(Map<String, String> requestHeaders) {
		this.requestHeaders = requestHeaders;
	}

	public Map<String, String> getResponseHeaders() {
		return responseHeaders;
	}

	public void setResponseHeaders(Map<String, String> responseHeaders) {
		this.responseHeaders = responseHeaders;
	}

	public Object getContent() {
		return content;
	}

	public void setContent(Object content) {
		this.content = content;
	}

	public List<?> getElements() {
		return elements;
	}

	public void setElements(List<?> elements) {
		this.elements = elements;
	}

	public List<Object[]> getResults() {
		return results;
	}

	public void setResults(List<Object[]> results) {
		this.results = results;
	}

}
